/**
 * 
 */
package soapWS.tsRpcType;

import java.util.Date;

import javax.annotation.Resource;
import javax.jws.WebService;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;

/**
 * The @WebService property endpointInterface links the SIB (this class) to the
 * SEI (ch01.ts.TimeServer). Note that the method implementations are not
 * annotated as @WebMethods.
*/
@WebService(endpointInterface = "soapWS.tsRpcType.TimeServer")
public class TimeServerImpl implements TimeServer {
	@Resource
    private WebServiceContext context;
	
	public String getTimeAsString() {
		MessageContext mc = context.getMessageContext();
		System.out.println("servlet context"+mc.SERVLET_CONTEXT);
      //  ServletContext servletContext = (ServletContext) mc.get(MessageContext.SERVLET_CONTEXT);
		return new Date().toString();
	}

	public long getTimeAsElapsed() {
		return new Date().getTime();
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}
}
